Optimal. Leaf size=108 \[ -\frac{(A-4 B) \tan (c+d x)}{3 a^2 d}+\frac{(A-2 B) \tanh ^{-1}(\sin (c+d x))}{a^2 d}-\frac{(A-2 B) \tan (c+d x)}{a^2 d (\sec (c+d x)+1)}+\frac{(A-B) \tan (c+d x) \sec ^2(c+d x)}{3 d (a \sec (c+d x)+a)^2} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.257217, antiderivative size = 108, normalized size of antiderivative = 1., number of steps used = 6, number of rules used = 6, integrand size = 31, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.194, Rules used = {4019, 4008, 3787, 3770, 3767, 8} \[ -\frac{(A-4 B) \tan (c+d x)}{3 a^2 d}+\frac{(A-2 B) \tanh ^{-1}(\sin (c+d x))}{a^2 d}-\frac{(A-2 B) \tan (c+d x)}{a^2 d (\sec (c+d x)+1)}+\frac{(A-B) \tan (c+d x) \sec ^2(c+d x)}{3 d (a \sec (c+d x)+a)^2} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 4019
Rule 4008
Rule 3787
Rule 3770
Rule 3767
Rule 8
Rubi steps
\begin{align*} \int \frac{\sec ^3(c+d x) (A+B \sec (c+d x))}{(a+a \sec (c+d x))^2} \, dx &=\frac{(A-B) \sec ^2(c+d x) \tan (c+d x)}{3 d (a+a \sec (c+d x))^2}+\frac{\int \frac{\sec ^2(c+d x) (2 a (A-B)-a (A-4 B) \sec (c+d x))}{a+a \sec (c+d x)} \, dx}{3 a^2}\\ &=-\frac{(A-2 B) \tan (c+d x)}{a^2 d (1+\sec (c+d x))}+\frac{(A-B) \sec ^2(c+d x) \tan (c+d x)}{3 d (a+a \sec (c+d x))^2}-\frac{\int \sec (c+d x) \left (-3 a^2 (A-2 B)+a^2 (A-4 B) \sec (c+d x)\right ) \, dx}{3 a^4}\\ &=-\frac{(A-2 B) \tan (c+d x)}{a^2 d (1+\sec (c+d x))}+\frac{(A-B) \sec ^2(c+d x) \tan (c+d x)}{3 d (a+a \sec (c+d x))^2}-\frac{(A-4 B) \int \sec ^2(c+d x) \, dx}{3 a^2}+\frac{(A-2 B) \int \sec (c+d x) \, dx}{a^2}\\ &=\frac{(A-2 B) \tanh ^{-1}(\sin (c+d x))}{a^2 d}-\frac{(A-2 B) \tan (c+d x)}{a^2 d (1+\sec (c+d x))}+\frac{(A-B) \sec ^2(c+d x) \tan (c+d x)}{3 d (a+a \sec (c+d x))^2}+\frac{(A-4 B) \operatorname{Subst}(\int 1 \, dx,x,-\tan (c+d x))}{3 a^2 d}\\ &=\frac{(A-2 B) \tanh ^{-1}(\sin (c+d x))}{a^2 d}-\frac{(A-4 B) \tan (c+d x)}{3 a^2 d}-\frac{(A-2 B) \tan (c+d x)}{a^2 d (1+\sec (c+d x))}+\frac{(A-B) \sec ^2(c+d x) \tan (c+d x)}{3 d (a+a \sec (c+d x))^2}\\ \end{align*}
Mathematica [B] time = 1.68355, size = 292, normalized size = 2.7 \[ \frac{2 \cos \left (\frac{1}{2} (c+d x)\right ) \sec (c+d x) (A+B \sec (c+d x)) \left (-(A-B) \tan \left (\frac{c}{2}\right ) \cos \left (\frac{1}{2} (c+d x)\right )+(B-A) \sec \left (\frac{c}{2}\right ) \sin \left (\frac{d x}{2}\right )+\cos ^3\left (\frac{1}{2} (c+d x)\right ) \left (\frac{6 B \sin (d x)}{\left (\cos \left (\frac{c}{2}\right )-\sin \left (\frac{c}{2}\right )\right ) \left (\sin \left (\frac{c}{2}\right )+\cos \left (\frac{c}{2}\right )\right ) \left (\cos \left (\frac{1}{2} (c+d x)\right )-\sin \left (\frac{1}{2} (c+d x)\right )\right ) \left (\sin \left (\frac{1}{2} (c+d x)\right )+\cos \left (\frac{1}{2} (c+d x)\right )\right )}-6 (A-2 B) \left (\log \left (\cos \left (\frac{1}{2} (c+d x)\right )-\sin \left (\frac{1}{2} (c+d x)\right )\right )-\log \left (\sin \left (\frac{1}{2} (c+d x)\right )+\cos \left (\frac{1}{2} (c+d x)\right )\right )\right )\right )-2 (4 A-7 B) \sec \left (\frac{c}{2}\right ) \sin \left (\frac{d x}{2}\right ) \cos ^2\left (\frac{1}{2} (c+d x)\right )\right )}{3 a^2 d (\sec (c+d x)+1)^2 (A \cos (c+d x)+B)} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.053, size = 205, normalized size = 1.9 \begin{align*} -{\frac{A}{6\,d{a}^{2}} \left ( \tan \left ({\frac{dx}{2}}+{\frac{c}{2}} \right ) \right ) ^{3}}+{\frac{B}{6\,d{a}^{2}} \left ( \tan \left ({\frac{dx}{2}}+{\frac{c}{2}} \right ) \right ) ^{3}}-{\frac{3\,A}{2\,d{a}^{2}}\tan \left ({\frac{dx}{2}}+{\frac{c}{2}} \right ) }+{\frac{5\,B}{2\,d{a}^{2}}\tan \left ({\frac{dx}{2}}+{\frac{c}{2}} \right ) }+{\frac{A}{d{a}^{2}}\ln \left ( \tan \left ({\frac{dx}{2}}+{\frac{c}{2}} \right ) +1 \right ) }-2\,{\frac{\ln \left ( \tan \left ( 1/2\,dx+c/2 \right ) +1 \right ) B}{d{a}^{2}}}-{\frac{B}{d{a}^{2}} \left ( \tan \left ({\frac{dx}{2}}+{\frac{c}{2}} \right ) +1 \right ) ^{-1}}-{\frac{A}{d{a}^{2}}\ln \left ( \tan \left ({\frac{dx}{2}}+{\frac{c}{2}} \right ) -1 \right ) }+2\,{\frac{\ln \left ( \tan \left ( 1/2\,dx+c/2 \right ) -1 \right ) B}{d{a}^{2}}}-{\frac{B}{d{a}^{2}} \left ( \tan \left ({\frac{dx}{2}}+{\frac{c}{2}} \right ) -1 \right ) ^{-1}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] time = 1.02155, size = 329, normalized size = 3.05 \begin{align*} \frac{B{\left (\frac{\frac{15 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac{\sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}}}{a^{2}} - \frac{12 \, \log \left (\frac{\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + 1\right )}{a^{2}} + \frac{12 \, \log \left (\frac{\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - 1\right )}{a^{2}} + \frac{12 \, \sin \left (d x + c\right )}{{\left (a^{2} - \frac{a^{2} \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}}\right )}{\left (\cos \left (d x + c\right ) + 1\right )}}\right )} - A{\left (\frac{\frac{9 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac{\sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}}}{a^{2}} - \frac{6 \, \log \left (\frac{\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + 1\right )}{a^{2}} + \frac{6 \, \log \left (\frac{\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - 1\right )}{a^{2}}\right )}}{6 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 0.490716, size = 501, normalized size = 4.64 \begin{align*} \frac{3 \,{\left ({\left (A - 2 \, B\right )} \cos \left (d x + c\right )^{3} + 2 \,{\left (A - 2 \, B\right )} \cos \left (d x + c\right )^{2} +{\left (A - 2 \, B\right )} \cos \left (d x + c\right )\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) - 3 \,{\left ({\left (A - 2 \, B\right )} \cos \left (d x + c\right )^{3} + 2 \,{\left (A - 2 \, B\right )} \cos \left (d x + c\right )^{2} +{\left (A - 2 \, B\right )} \cos \left (d x + c\right )\right )} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \,{\left (2 \,{\left (2 \, A - 5 \, B\right )} \cos \left (d x + c\right )^{2} +{\left (5 \, A - 14 \, B\right )} \cos \left (d x + c\right ) - 3 \, B\right )} \sin \left (d x + c\right )}{6 \,{\left (a^{2} d \cos \left (d x + c\right )^{3} + 2 \, a^{2} d \cos \left (d x + c\right )^{2} + a^{2} d \cos \left (d x + c\right )\right )}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F] time = 0., size = 0, normalized size = 0. \begin{align*} \frac{\int \frac{A \sec ^{3}{\left (c + d x \right )}}{\sec ^{2}{\left (c + d x \right )} + 2 \sec{\left (c + d x \right )} + 1}\, dx + \int \frac{B \sec ^{4}{\left (c + d x \right )}}{\sec ^{2}{\left (c + d x \right )} + 2 \sec{\left (c + d x \right )} + 1}\, dx}{a^{2}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.37016, size = 204, normalized size = 1.89 \begin{align*} \frac{\frac{6 \,{\left (A - 2 \, B\right )} \log \left ({\left | \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) + 1 \right |}\right )}{a^{2}} - \frac{6 \,{\left (A - 2 \, B\right )} \log \left ({\left | \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) - 1 \right |}\right )}{a^{2}} - \frac{12 \, B \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )}{{\left (\tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{2} - 1\right )} a^{2}} - \frac{A a^{4} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{3} - B a^{4} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{3} + 9 \, A a^{4} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) - 15 \, B a^{4} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )}{a^{6}}}{6 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]